<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/common/includes.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>zzzzzz</title>
	<%@ include file="/WEB-INF/common/meta.jsp" %>
	<link type="text/css" rel="stylesheet" href="${ctx}/res/css/main.css" />
	<script type="text/javascript" src="${ctx}/res/js/jquery/jquery-1.6.1.min.js"></script>
	<script type="text/javascript">
		var jq = jQuery.noConflict();
	</script>
	<script type="text/javascript" src="${ctx}/res/js/main.js"></script>
</head>
<body>

<%@ include file="/WEB-INF/common/header.jsp" %>

<div id="new-post" class="site-wrap wrap">
	<c:choose>
		<c:when test="${topicVo.topicId == null && cmd == 'edit'}">
			<div class="msg-error"><c:out value="${msg_topic_not_found}"></c:out></div>
		</c:when>
		<c:otherwise>
			<div class="content-wrap">
				<form:form id="new-post-form" method="post" modelAttribute="topicVo" action="${ctx}/topic/add_or_edit">
					<c:choose>
						<c:when test="${cmd == 'edit'}"><h1>Edit topic</h1></c:when>
						<c:otherwise><h1>New post</h1></c:otherwise>
					</c:choose>
					
					<div class="basic-box">
						<form:errors path="*" element="div" cssClass="msg-error"/>
						<form:hidden path="topicId" />
						<div class="fieldset">
							<label for="new-post-title" class="column of-five">Title</label><form:input path="title" id="new-post-title" size="255" maxlength="255" class="double-column column of-five" />
						</div>
						<div class="fieldset">
							<label for="new-post-content" class="column of-five">Content</label>
							<form:textarea path="content" id="new-post-content" class="column" />
						</div>
						<div class="fieldset">
							<span class="column of-five"></span>
							<c:choose>
								<c:when test="${cmd == 'edit'}"><input type="submit" id="new-post-submit" value="Save" name="submit" class="style3-button medium-button button" /></c:when>
								<c:otherwise><input type="submit" id="new-post-submit" value="Post" name="submit" class="style3-button medium-button button" /></c:otherwise>
							</c:choose>
							
						</div>
					</div>
				</form:form>
			</div>
		</c:otherwise>
	</c:choose>

</div>
		
	
<%@ include file="/WEB-INF/common/footer.jsp" %>

</body>
</html>